<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript">
$(function(){
	//$("body").loader('show','<i class="fa fa-2x fa-spinner fa-spin"></i>');
	$("#staff_form").validate({
		submitHandler:function(){
			btnSubmit();
		},
	});
})
function btnSubmit(){
	$("#staff_form").validate();
	var oldPassWord = $("#oldPassWord").val();
	var newPassWord = $("#newPassWord").val();
	var repeat_password = $("#repeat_password").val();
	if(newPassWord != repeat_password){
		$.gritter.add({
			title: '提示',
			text: "两次输入的密码不一致",
			class_name: 'gritter-error'
		});
		return;
	}
	var param = {};
	param.newPassWord = newPassWord;
	param.oldPassWord = oldPassWord;
	$.ajax({
		url : "/admin/staff/changePassword.do",
		data:param,
		type:"post",
		dataType:"json",
		success : function(data) {
			var class_name = "gritter-error";
			if(data.code == "0"){
				class_name = "gritter-success";
				$("#staff_form")[0].reset();
			}
			$.gritter.add({
				title: '提示',
				text: data.msg,
				class_name: class_name
			});
		}
	});
}
</script>
<div class="page-header">
	<h1>
		密码修改
	</h1>
</div>
<form class="form-horizontal" id="staff_form" method="post">
	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-3 no-padding-right"
			for="oldPassWord">
			原密码:
		</label>
		<div class="col-xs-12 col-sm-9">
			<div class="clearfix">
				<input type="password" name="oldPassWord" id="oldPassWord"
					class="col-xs-12 col-sm-5" required/>
			</div>
		</div>
	</div>
	
	<div class="space-2"></div>
	
	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-3 no-padding-right"
			for="newPassWord">
			新密码:
		</label>
		<div class="col-xs-12 col-sm-9">
			<div class="clearfix">
				<input type="password" name="newPassWord" id="newPassWord" rangelength="[5,10]"
					class="col-xs-12 col-sm-5" required/>
			</div>
		</div>
	</div>
	<div class="space-2"></div>
	
	<div class="form-group">
		<label class="control-label col-xs-12 col-sm-3 no-padding-right"
			for="repeat_password">
			重复新密码:
		</label>
		<div class="col-xs-12 col-sm-9">
			<div class="clearfix">
				<input type="password" name="repeat_password" equalTo="#newPassWord" id="repeat_password"
					class="col-xs-12 col-sm-5" required/>
			</div>
		</div>
	</div>
	<div class="clearfix form-actions" id="operation_btn_div" >
			<div class="col-md-offset-3 col-md-9">
				<button class="btn btn-info" type="submit">
					<i class="ace-icon fa fa-check bigger-110"></i>
					提交
				</button>
			</div>
	</div>
</form>